<template>
	<view class="c-xconetnt-img-wrap">
		<image :src='imagePath' :style="{ width: dpwidth + 'px', height: dpwidth/item.width * item.height + 'px' }" @click="click" mode="aspectFill"></image>
	</view>
</template>

<script>
	export default {
		props: {
			item: Object,
			imgs: Array,
			pwidth: Number
		},
		computed: {
			dpwidth() {
				if (this.pwidth) return this.pwidth;

				return this.$ba.dwidth();
			},
			imagePath() {
				return this.item.content;
			},
		},
		methods: {
			click() {
				let img = this.item.content;
				let urls = this.imgs ? this.imgs : [img];
				uni.previewImage({
					current: img,
					indicator: 'number',
					urls,
				});
			}
		}
	}
</script>

<style>
	.c-xconetnt-img-wrap {
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>
